Skip to content

Fix target-specific feature gating in the WASM adapter - #493

Closed
lxsaah wants to merge 3 commits into
mainfrom
fix/wasm-feature-gating
Closed

lxsaah wants to merge 3 commits into
mainfrom
fix/wasm-feature-gating

Conversation

@lxsaah

@lxsaah lxsaah commented Nov 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Scope browser bindings and WASM test dependencies to wasm32.
  • Update target-specific buffer synchronization and timer handling in the WASM adapter.

Verification

  • git diff --check passed. Tests were not run for this PR submission.

lxsaah commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

#496 is a narrower alternative to this PR. It only gates the unsafe impl Send/Sync on WasmBuffer and WasmBufferReader to wasm32, and uses Arc<Mutex> for native builds. The browser build is unchanged, and it adds a native test that pushes from another thread while a reader waits.

It leaves out two parts of this PR:

  • Removing the guard that stops native builds with wasm-runtime on. Without the guard, a native build with default features compiles, but sleep returns at once, the clock always reads 0 and logs are dropped. Before, the build failed with a clear message.
  • The file reorganisation. It's fine as cleanup, but it's better reviewed on its own.

Two other points if this PR goes ahead:

  • lock_state uses .expect("...poisoned"). A panicking T::clone while the lock is held then makes every later call on that buffer panic. unwrap_or_else(PoisonError::into_inner) avoids this.
  • transform_join_integration_tests.rs is now wasm32-only, so plain cargo test no longer compiles it. The README now recommends that command.

Generated by Claude Code

lxsaah commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Closing without merging. The adapter is browser-only, and native builds exist only as a test shortcut. Making native builds easier (dropping the compile_error! guard and adding a no-op time fallback) works against that. The guard correctly stops anyone building it natively by mistake, while the fallback would let such a build compile and silently do nothing. The narrower soundness fix in #496 is also closed, for the same reason.

The file reorganisation (cancellation.rs, time/browser.rs) is fine as cleanup if we want it later, as a separate PR with no behaviour changes.


Generated by Claude Code

@lxsaah lxsaah closed this Nov 22, 2026
@lxsaah
lxsaah deleted the fix/wasm-feature-gating branch November 22, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant